package fun.sboy.headacheMemo.mapper;

import fun.sboy.headacheMemo.dto.ArticleSearch;
import fun.sboy.headacheMemo.entry.Article;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface ArticleMapper {

    /**
     * 添加文章
     *
     * @param article
     */
    int insertArticle(Article article);

    /**
     * 修改文章
     *
     * @param article
     */
    int updateArticle(Article article);

    /**
     * 搜索文章
     *
     * @param search
     * @return
     */
    List<Article> selectListArticle(ArticleSearch search);

    /**
     * 删除文章
     *
     * @param aid
     * @param uid
     */
    int deleteArticleByAid(@Param("aid") String aid, @Param("uid") String uid);

    /**
     * 通过id获取文章
     *
     * @param aid
     * @return
     */
    Article selectArticleByAid(@Param("aid") String aid);

    List<Article> selectHotArticle();
}
